#ifndef __QF_DB_REDIS_H__
#define __QF_DB_REDIS_H__

#include <hiredis/hiredis.h>
#include "QF_db.h"

/* Use the format of:
 * {
 *	 "File_name" : [
 *		"Path1",
 *		"Path2",
 *		...,
 *		"PathN"
 *	 ]
 * }
 * Two layer for it.
 * Outer layer use hash.
 * Inner layer use list.
 */
class redis_con : public db_base {
public:
	redis_con ();
	~redis_con ();
	DBerr db_insert_one_path (const char *);
	std::vector<char *> db_find_one_name (const char *);
	void db_debug_all_data (void);
private:
	DBerr db_reset ();
	DBerr redis_con_check_set_command (redisReply *);
	DBerr redis_con_add_sender (const char *);
	DBerr redis_con_add_outer (const char *);
	DBerr redis_con_add_inner (const char *, const char *);
	void redis_con_debug_tab (int);
	void redis_con_debug_reply (redisReply *, int);
	void redis_con_debug_inner_layer (redisReply *);
private:
	redisContext *rc;
};

#endif
